package ed.hbut.supermarket1.mapper;


import ed.hbut.supermarket1.entity.Goods;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface GoodsMapper {


    @Insert("insert into goods(GoodsName, GoodsInventory, GoodsInventoryState, GoodsSalesState, GoodsSupplierName, Supplier_SupplierID) value(#{goodsName},#{goodsInventory},#{goodsInventoryState},#{goodsSalesState},#{goodsSupplierName},#{supplierSupplierID})")
    void addGoods(Goods goods);

    @Select("select * from goods ")
    List<Goods> getGoods();

    @Select("select * from goods where GoodsID=#{id}")
    Goods getGoodsById(int id);

    @Update("update goods set GoodsInventory=#{goodsInventory},GoodsName=#{goodsName},GoodsSupplierName=#{goodsSupplierName},Supplier_SupplierID=#{supplierSupplierID} where GoodsID=#{goodsID} ")
    void updateGoods(Goods goods);

    @Delete("delete from goods where GoodsID=#{id}")
    void deleteGoods(int id);
}
